<#include "/common/layout.html"> 
<@layout title="123">
<script type="text/javascript" src="/js/easyui/easyui_grid.js"></script>
<script type="text/javascript">
var model_name = "/shop";
var model_title="商铺列表";
var datagrid;
	$(function() {

	    $('#edit_marketId').combobox({    
	    	url: '/market/combobox',   
		    valueField:'id',    
		    textField:'name',
		    width:150,
		    editable:false
		    /* ,
		    onSelect:function(record){  
		    	$("#edit_categoryId").combobox({
		    		url: '/shopCategory/comboboxMarketCategory/' + record.id,    
		    		valueField:'id',    
				    textField:'name'
	    		})
	    	} */
	    });
	    
	    /* $("#edit_categoryId").combobox({
			url: '/shopCategory/comboboxMarketCategory',    
			valueField:'id',    
		    textField:'name',
		    editable:false,
		    width:150
		});	 */
	    
	    $("#edit_userId").combobox({    
		    url: '/merchant/combobox',   
		    valueField:'id',    
		    textField:'name',
		    editable:false,
		    width:150
		}); 
		
		
		datagrid=$('#form_datagrid').datagrid({
		 	url:model_name+'/grid',
		 	rownumbers:true,
		 	columns:[[    
		        {field:'id',title:'编号',width:100,checkbox:true},
		        {field:'marketName',title:'所属市场',width:100},
		        {field:'categoryName',title:'所属分类',width:100,
		        	formatter:function(value,row,index){
		        		if(row.categoryName==null){
		        			return "";
		        		}else{
		        			return "<a href='#' title='"+value+"'>"+value+"</a>";
		        		}
					}
		        },
		        {field:'userName',title:'对应账户',width:60},
		        {field:'userPhone',title:'对应手机号',width:90},
		        {field:'name',title:'商铺名称',width:110},
		        {field:'recommend',title:'推荐',width:36,align:'center',
		      		formatter:function(value,row,index){
			      		if(row.recommend==1){
			      			return "<font color='red'> √ </font>";
			      		}
					}
				},
		        {field:'status',title:'状态',width:50,
		      		formatter:function(value,row,index){
			      		if(row.status==1){
			      			return "正常";
			      		}else{
			      			return "无效";
			      		}
					}
				},
		        {field:'summary',title:'商铺简介',width:120},
		        //{field:'phone',title:'商户电话',width:90},
		        {field:'logo',title:'商户图片',width:100,
		        	formatter:function(value,row,index){
		        	if(value)
		        	return "<span url='"+value+"' style='cursor:pointer;color:blue;'  onmouseover='hoverShow(this);'onmouseout='$(\"#imgShow\").hide();'>"+value+"</span>";
		        }},
		        {field:'seq',title:'排序',width:40},
		        {field:'created_time',title:'创建时间',width:100},
		        {field:'cz',title:'摄像头',
			        formatter:function(value,row,index){
			        	return "<a href='#' onclick='cameraView("+row.id+")' class='linkbutton' icon='icon-print'>摄像头管理</a>";
			        }
		        },
		        {field:'sq',title:'社区服务点',
			        formatter:function(value,row,index){
			        	return "<a href='#' onclick='communityView("+row.id+")' class='linkbutton' icon='icon-print'>可配送社区</a>";
			        }
		        }
		    ]],
		    onLoadSuccess:function(data){
				$(".linkbutton").linkbutton();
			}
		})
	})
</script>

<div id="DialogCamera_"></div>
<script type="text/javascript">
//查看摄像头
function cameraView(id_,title){
	cameraOoip(model_name+"/camera/"+id_,title);
}
function cameraOoip(url,title){
	$('#DialogCamera_').dialog({
	    title: '对应摄像头-'+model_title,   
	    width: 820,   
	    height: 450,
	    top:0, 
	    cache: false,
	    maximizable:true,
	    href: url,   
	    modal: true,
	    onLoad:function(){
	    	$.messager.progress('close');
	    },
	    onLoadError:function(){
	    	$.messager.progress('close');
	    },
		buttons:[{
			text:"关闭",
			handler:function() {
				$('#DialogCamera_').dialog('close');
			}
		}]
	});
}
</script>

<div id="DialogCommunity_"></div>
<script type="text/javascript">
//查看社区服务点
function communityView(id_,title){
	communityOoip(model_name+"/community/"+id_,title);
}
function communityOoip(url,title){
	$('#DialogCommunity_').dialog({
	    title: '可配送社区服务点-'+model_title,   
	    width: 840,   
	    height: 450,
	    top:0, 
	    cache: false,
	    maximizable:true,
	    href: url,   
	    modal: true,
	    onLoad:function(){
	    	$.messager.progress('close');
	    },
	    onLoadError:function(){
	    	$.messager.progress('close');
	    },
		buttons:[{
			text:"关闭",
			handler:function() {
				$('#DialogCommunity_').dialog('close');
			}
		}]
	});
}
</script>

<script type="text/javascript" src="/js/easyui/easyui_grid_common.js"></script>
</head>
	<#include "/common/seach.html" />
	<@seach>
	<#if session.current_admin?? && session.current_admin.role_ids?? && session.current_admin.role_ids=='6'>
	<#else>
	
	<td>所属市场</td>
	<td><input id="edit_marketId" name="EQ_m.id"></td> 
	<!-- <td>所属分类</td>
	<td><input id="edit_categoryId" name="EQ_c.id"></td>  -->
	<td>对应商户</td>
	<td><input id="edit_userId" name="EQ_u.id"></td> 
	<td>商铺名称</td>
	<td><input type="text" name="LIKE_s.name"></li></td>
	</#if>
	</@seach>
</@layout>